package com.edu.web.controller.info;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.edu.common.annotation.Log;
import com.edu.common.core.controller.BaseController;
import com.edu.common.core.domain.AjaxResult;
import com.edu.common.enums.BusinessType;
import com.edu.system.domain.TExamMiss;
import com.edu.system.service.ITExamMissService;
import com.edu.common.utils.poi.ExcelUtil;
import com.edu.common.core.page.TableDataInfo;

/**
 * 缺考记录Controller
 * 
 * @author xxxx
 * @date 2024-01-11
 */
@RestController
@RequestMapping("/system/miss")
public class TExamMissController extends BaseController
{
    @Autowired
    private ITExamMissService tExamMissService;

    /**
     * 查询缺考记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:miss:list')")
    @GetMapping("/list")
    public TableDataInfo list(TExamMiss tExamMiss)
    {
        startPage();
        List<TExamMiss> list = tExamMissService.selectTExamMissList(tExamMiss);
        return getDataTable(list);
    }

    /**
     * 导出缺考记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:miss:export')")
    @Log(title = "缺考记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TExamMiss tExamMiss)
    {
        List<TExamMiss> list = tExamMissService.selectTExamMissList(tExamMiss);
        ExcelUtil<TExamMiss> util = new ExcelUtil<TExamMiss>(TExamMiss.class);
        util.exportExcel(response, list, "缺考记录数据");
    }

    /**
     * 获取缺考记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:miss:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tExamMissService.selectTExamMissById(id));
    }

    /**
     * 新增缺考记录
     */
    @PreAuthorize("@ss.hasPermi('system:miss:add')")
    @Log(title = "缺考记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TExamMiss tExamMiss)
    {
        return toAjax(tExamMissService.insertTExamMiss(tExamMiss));
    }

    /**
     * 修改缺考记录
     */
    @PreAuthorize("@ss.hasPermi('system:miss:edit')")
    @Log(title = "缺考记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TExamMiss tExamMiss)
    {
        return toAjax(tExamMissService.updateTExamMiss(tExamMiss));
    }

    /**
     * 删除缺考记录
     */
    @PreAuthorize("@ss.hasPermi('system:miss:remove')")
    @Log(title = "缺考记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tExamMissService.deleteTExamMissByIds(ids));
    }
}
